function grid(com, grid)
{
    if(com == 'Select All')
    {
        $('.bDiv tbody tr',grid).addClass('trSelected');
    }
    
    if(com == 'De-select All')
    {
        $('.bDiv tbody tr',grid).removeClass('trSelected');
    }
        
    if(com.indexOf("New ") >= 0)
    {
        window.location = window.location.pathname + "/create/";
    }
    
    if(com == 'Edit' || com == 'Delete')
    {
        var items;
        var itemlist;
    }

    if(com == 'Batch Edit')
    {
        if($('.trSelected').length > 0)
        {
            items = $('.trSelected');
            itemlist = '';

            for(i = 0; i < items.length; i++)
            {
                if(itemlist)
                {
                    itemlist += ":";
                }

                itemlist += items[i].id.substr(3);
            }

            window.location = window.location.pathname + "/edit/" + itemlist + "/";
        }
        else
        {
            return false;
        }
    }

    if(com == 'Batch Edit')
    {
        if($('.trSelected').length > 0)
        {
            items = $('.trSelected');
            itemlist = '';

            for(i = 0; i < items.length; i++)
            {
                if(itemlist)
                {
                    itemlist += ":";
                }

                itemlist += items[i].id.substr(3);
            }

            window.location = window.location.pathname + "/edit/" + itemlist + "/";
        }
        else
        {
            return false;
        }
    }
}
